if action is SELECT_FOLDER, then return the currentd folder if none is
authorJonathan Blandford <jrb@gnome.org>
Sun, 7 Mar 2004 08:15:09 +0000 (08:15 +0000)
committerJonathan Blandford <jrb@src.gnome.org>
Sun, 7 Mar 2004 08:15:09 +0000 (08:15 +0000)
Sun Mar  7 03:03:57 2004  Jonathan Blandford  <jrb@gnome.org>

        * gtk/gtkfilechooserdefault.c
        (gtk_file_chooser_default_get_paths): if action is
        SELECT_FOLDER, then return the currentd folder if none is
        selected.
        (gtk_file_chooser_default_should_respond): Allow 'Ok' to be hit if
        no directory is selected in SELECT_FOLDER mode.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c

index daa8591f0874145ee3ffcc16faca8df44c1249c2..84454c978592630a074c5093b3dce3470a72f315 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Mar  7 03:03:57 2004  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_get_paths): if action is
+       SELECT_FOLDER, then return the currentd folder if none is
+       selected.
+       (gtk_file_chooser_default_should_respond): Allow 'Ok' to be hit if
+       no directory is selected in SELECT_FOLDER mode.
+
 Sat Mar  6 23:31:18 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
index daa8591f0874145ee3ffcc16faca8df44c1249c2..84454c978592630a074c5093b3dce3470a72f315 100644 (file)
@@ -1,3 +1,12 @@
+Sun Mar  7 03:03:57 2004  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_get_paths): if action is
+       SELECT_FOLDER, then return the currentd folder if none is
+       selected.
+       (gtk_file_chooser_default_should_respond): Allow 'Ok' to be hit if
+       no directory is selected in SELECT_FOLDER mode.
+
 Sat Mar  6 23:31:18 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
index daa8591f0874145ee3ffcc16faca8df44c1249c2..84454c978592630a074c5093b3dce3470a72f315 100644 (file)
@@ -1,3 +1,12 @@
+Sun Mar  7 03:03:57 2004  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_get_paths): if action is
+       SELECT_FOLDER, then return the currentd folder if none is
+       selected.
+       (gtk_file_chooser_default_should_respond): Allow 'Ok' to be hit if
+       no directory is selected in SELECT_FOLDER mode.
+
 Sat Mar  6 23:31:18 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
index daa8591f0874145ee3ffcc16faca8df44c1249c2..84454c978592630a074c5093b3dce3470a72f315 100644 (file)
@@ -1,3 +1,12 @@
+Sun Mar  7 03:03:57 2004  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_get_paths): if action is
+       SELECT_FOLDER, then return the currentd folder if none is
+       selected.
+       (gtk_file_chooser_default_should_respond): Allow 'Ok' to be hit if
+       no directory is selected in SELECT_FOLDER mode.
+
 Sat Mar  6 23:31:18 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
index daa8591f0874145ee3ffcc16faca8df44c1249c2..84454c978592630a074c5093b3dce3470a72f315 100644 (file)
@@ -1,3 +1,12 @@
+Sun Mar  7 03:03:57 2004  Jonathan Blandford  <jrb@gnome.org>
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_get_paths): if action is
+       SELECT_FOLDER, then return the currentd folder if none is
+       selected.
+       (gtk_file_chooser_default_should_respond): Allow 'Ok' to be hit if
+       no directory is selected in SELECT_FOLDER mode.
+
 Sat Mar  6 23:31:18 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (struct _GtkFileChooserDefault):
index e881f0034631caa53567b537f34a3f14ec98c903..ad5f0a80a4a132572c6fde8dbb58591fbc194ceb 100644 (file)
@@ -3059,6 +3059,14 @@ gtk_file_chooser_default_get_paths (GtkFileChooser *chooser)
   if (info.path_from_entry)
     info.result = g_slist_prepend (info.result, info.path_from_entry);
 
+  /* If there's no folder selected, and we're in SELECT_FOLDER mode, then we
+   * fall back to the current directory */
+  if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
+      info.result == NULL)
+    {
+      info.result = g_slist_prepend (info.result, gtk_file_path_copy (impl->current_folder));
+    }
+
   return g_slist_reverse (info.result);
 }
 
@@ -3438,12 +3446,15 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
        return FALSE;
     }
 
-  /* Second, do we have an empty selection? */
-
-  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
-  num_selected = gtk_tree_selection_count_selected_rows (selection);
-  if (num_selected == 0)
-    return FALSE;
+  /* Second, do we have an empty selection */
+  if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+      || impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+    {
+      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+      num_selected = gtk_tree_selection_count_selected_rows (selection);
+      if (num_selected == 0)
+       return FALSE;
+    }
 
   /* Third, should we return file names or folder names? */